package TechStuff;


import java.rmi.RemoteException;
import java.rmi.registry.LocateRegistry;
import java.rmi.registry.Registry;

import Models.Point2D;

public class ClientStub
extends RmiStarter implements ClientInterface {
	private ClientInterface client;
	private int id;
	
	public ClientStub(int id)
	{
		super(ClientInterface.class);
		this.id = id;
		doCustomRmiHandling();
		
	}


	@Override
	public void doCustomRmiHandling() {
		String host = "localhost";
		try {
		    Registry registry = LocateRegistry.getRegistry(host);
		    client =  (ClientInterface) registry.lookup(name + id);
		} catch (Exception e) {
		    System.err.println("Client exception: " + e.toString());
		    e.printStackTrace();
		}
		
	}


	@Override
	public void piceMoved(Point2D from, Point2D to) throws RemoteException {
		client.piceMoved(from, to);
		
	}
	

}
